#### Produce some plots

### Read in raw data

abund = read.csv('/home1/99/jc152199/Abundance/AbundanceBySample.csv',header=T)

### Establish plotting directory

plot.dir = '/home1/99/jc152199/Abundance/Plots/'

### Need to loop plotting to produce single plot of abundance versus air temp and sub temp, with different species represented by different symbols

for (spp in unique(abund$spp))

	{
	
	### Split to a single species
	
	tabund = abund[which(abund$spp==spp),]
	
	### Create a species plotting directory
	
	dir.create(paste(plot.dir,spp,sep='/'))
	
	### Set as spp.dir
	
	spp.dir = paste(plot.dir,spp,'/',sep='/')
	
	### Start plotting
	
	for (s.char in c('start','cloud_perc','wet','airtemp','subtemp','hum'))
	
		{
		
		png(paste(spp.dir,s.char,'.png',sep=''), units='cm', height=10, width=10, res=1000)
		
		plot(tabund[,which(names(tabund)[]==s.char)], tabund$abund, type='p', pch=17, col='red', xlab=paste(s.char,sep=''), ylab='Abundance', main=spp)
		
		if (s.char=='start')
		
		{
		
		plot(substr(tabund[,which(names(tabund)[]==s.char)],1,2), tabund$abund, type='p', pch=17, col='red', xlab=paste(s.char,sep=''), ylab='Abundance', main=spp)
		
		}
		
		dev.off()
		
		}
	
	}
	
### Done

